import { ManageCommonAPI } from '@/pages/type';

const getHomeTaskSearchList = (queryTypeObj: Record<string, any>, tabSwitchType: string): ManageCommonAPI.ISearchList => {
  // 名称 资金来源 状态 资金流向 支付方式 相对方
  return [
    {
      name: queryTypeObj?.params,
      placeholder: '权限参数',
      label: '权限参数',
      componentType: 'QueryParams',
      allowClear: true,
      md: 6,
      sm: 24,
      whetherSenior: false,
    },
  ];
};

const homeTaskSearchConfig = () => {
  // 自定义各自业务中审批任务搜索字段
  const taskCheckConfig = [
    {
      fieldName: 'contractName',
      fieldType: 'String',
      fieldParam: 0,
      fieldUse: 0,
      searchType: 0,
      isSearch: 0,
      seq: 0,
    },
    {
      fieldName: 'contractCode',
      fieldType: 'String',
      fieldParam: 0,
      fieldUse: 0,
      searchType: 0,
      isSearch: 0,
      seq: 0,
    },
    {
      fieldName: 'projectName',
      fieldType: 'String',
      fieldParam: 0,
      fieldUse: 0,
      searchType: 0,
      isSearch: 0,
      seq: 0,
    },
    {
      fieldName: 'capitalDir',
      fieldType: 'Integer',
      fieldParam: 1,
      fieldUse: 0,
      searchType: 1,
      isSearch: 0,
      seq: 0,
    },
    {
      fieldName: 'payStyle',
      fieldType: 'String',
      fieldParam: 1,
      fieldUse: 0,
      searchType: 1,
      isSearch: 0,
      seq: 0,
    },

    {
      fieldName: 'majorFlag',
      fieldType: 'Integer',
      fieldParam: 1,
      fieldUse: 0,
      searchType: 1,
      isSearch: 0,
      seq: 0,
    },

    // {
    //   fieldName: 'sumInTax',
    //   fieldType: 'BigDecimal',
    //   fieldParam: 0,
    //   fieldUse: 0,
    //   searchType: 1,
    //   isSearch: 0,
    //   seq: 0,
    // },

    {
      fieldName: 'budgetFlag',
      fieldType: 'Integer',
      fieldParam: 1,
      fieldUse: 0,
      searchType: 1,
      isSearch: 0,
      seq: 0,
    },
    {
      fieldName: 'createTime',
      fieldType: 'Date',
      fieldParam: 0,
      fieldUse: 0,
      searchType: 0,
      isSearch: 0,
      seq: 0,
    },
    {
      fieldName: 'changeWay',
      fieldType: 'Integer',
      fieldParam: 1,
      fieldUse: 0,
      searchType: 1,
      isSearch: 0,
      seq: 0,
    },
    {
      fieldName: 'contractInfo',
      fieldType: 'String',
      fieldParam: 0,
      fieldUse: 0,
      searchType: 0,
      isSearch: 0,
      seq: 0,
    },
    {
      fieldName: 'pID',
      fieldType: 'String',
      fieldParam: 0,
      fieldUse: 0,
      searchType: 0,
      isSearch: 0,
      seq: 0,
    },
    {
      fieldName: 'id',
      fieldType: 'String',
      fieldParam: 0,
      fieldUse: 0,
      searchType: 0,
      isSearch: 0,
      seq: 0,
    },
    {
      fieldName: 'ownerID',
      fieldType: 'String',
      fieldParam: 0,
      fieldUse: 0,
      searchType: 0,
      isSearch: 0,
      seq: 0,
    },
    {
      fieldName: 'state',
      fieldType: 'String',
      fieldParam: 1,
      fieldUse: 0,
      searchType: 1,
      isSearch: 0,
      seq: 0,
    },
    {
      fieldName: 'checkState',
      fieldType: 'String',
      fieldParam: 1,
      fieldUse: 0,
      searchType: 1,
      isSearch: 0,
      seq: 0,
    },
  ];
  return taskCheckConfig;
};

/** 搜索参数 */
const getHomeSearchList = (queryTypeObj: Record<string, any>) => {
  return [
    {
      name: 'state',
      placeholder: '合同状态',
      label: '合同状态',
      componentType: 'Select',
      allowClear: true,
      dataSource: [],
      md: 4,
      sm: 24,
      whetherSenior: false,
      searchParams: {
        fieldType: 'String',
        fieldParam: 1,
        fieldUse: 0,
        searchType: 1,
        seq: 0,
      },
    },
    {
      name: 'checkState',
      placeholder: '审核状态',
      label: '审核状态',
      componentType: 'Select',
      allowClear: true,
      dataSource: [],
      md: 4,
      sm: 24,
      whetherSenior: false,
      searchParams: {
        fieldType: 'String',
        fieldParam: 1,
        fieldUse: 0,
        searchType: 1,
        seq: 0,
      },
    },
    {
      name: queryTypeObj?.params,
      placeholder: '权限参数',
      label: '权限参数',
      componentType: 'QueryParams',
      allowClear: true,
      md: 6,
      sm: 24,
      whetherSenior: false,
      searchParams: {
        fieldType: 'String',
        // fieldParam: 5,
        fieldParam:
          queryTypeObj?.params == 'ownCompanyID' ? 5 : queryTypeObj?.params == 'ownDepartmentID' ? '4' : queryTypeObj?.params == 'ownerID' ? '2' : '3',
        fieldUse: 0,
        searchType: 2,
        seq: 0,
      },
    },
  ];
};

export { getHomeSearchList, getHomeTaskSearchList, homeTaskSearchConfig };
